<?php


namespace App\Crontab;

use App\Model\Finance\Util;
use EasySwoole\EasySwoole\Crontab\AbstractCronTask;
use EasySwoole\EasySwoole\Task\TaskManager;

class RedPackTask extends AbstractCronTask
{
    public static function getRule(): string
    {
        // TODO: Implement getRule() method.
        return '0 10 * * *';
    }

    public static function getTaskName(): string
    {
        // TODO: Implement getTaskName() method.
        return 'RedPackTask';
    }

    function run(int $taskId, int $workerIndex)
    {
        // TODO: Implement run() method.
        TaskManager::getInstance()->async(function () {
            Util::redpackInit(false);
        });
    }

    function onException(\Throwable $throwable, int $taskId, int $workerIndex)
    {
        // TODO: Implement onException() method.

    }


}